#include <ctime>
#include"BalanceTree.h"
int main( int argc , char* argv[])
{
    time_t begin,end;                
    /// to record time 
    int N = 1000;                 
    /// The number of elemnets.
    long int seed = 138546190734897; 
    /// to generate random number
    // Origin array not sorted
    std::cout << "The original array looks like : ";
    for(int i = 1; i<=N ;i++)
    {
       std::cout << seed % i << " ";
    }
    std::cout << std::endl;
    // Avt Tree test
    begin = clock();
    AVLTree<int> tree1;
    for(int i = 1; i<=N ;i++)
    {
        tree1.insert(seed % i);
    }
    end  = clock();
    std::cout << "The time used to insert is : " << (double)(end - begin)/CLOCKS_PER_SEC<< " seconds." << std ::endl; 
    std::cout << "The height of avl tree is : " << tree1.height() << std::endl;

    begin = clock();
    tree1.printout();
    end  = clock();
    std::cout << "The time used to travelsal is : " <<  (double)(end - begin)/CLOCKS_PER_SEC<< " seconds." <<std ::endl; 

    SplayTree<int> tree2;
    begin = clock();
    for(int i = 1; i<=N;i++)
    {
        tree2.insert(seed % i);
    }
    end  = clock();
    std::cout << "The time used to insert is : " <<  (double)(end - begin)/CLOCKS_PER_SEC<< " seconds." <<std ::endl; 
    std::cout << "The height of splay tree is : " << tree2.height() << std::endl;

    begin = clock();
    tree2.printout();
    end  = clock();
    std::cout << "The time used to travelsal is : " <<  (double)(end - begin)/CLOCKS_PER_SEC<< " seconds." <<std ::endl; 
    std::cout << "The height of splay tree is : " << tree2.height() << std::endl;


    return 0;
} 
